using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableCopyAirWallDao:DaoBase<TableCopyAirWall>
    {
        public override void AddPrimaryIndex(TableCopyAirWall model)
        {
            cachePrimary[model.BlockId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableCopyAirWall.txt";
        }

        protected override TableCopyAirWall ParseRowData(string[] rowData)
        {
            TableCopyAirWall data = new TableCopyAirWall();
			data.BlockId = rowData [0];
			data.MissionId = rowData [1];

            if (string.IsNullOrEmpty(rowData[2]))
            {
                data.BlockX = 0;
            }
            else
            {
                data.BlockX = double.Parse(rowData[2]);
            }

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.BlockY = 0;
            }
            else
            {
                data.BlockY = double.Parse(rowData[3]);
            }

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.BlockZ = 0;
            }
            else
            {
                data.BlockZ = double.Parse(rowData[4]);
            }

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.LoadBlock = 0;
            }
            else
            {
                data.LoadBlock = double.Parse(rowData[5]);
            }
			data.BlockRes = rowData [6];

            return data;
        }


        public override void AddOneIndex(TableCopyAirWall model)
        {
            if (!cacheOneIndex.ContainsKey(model.MissionId.ToString()))
            {
                cacheOneIndex[model.MissionId.ToString()] = new List<TableCopyAirWall>();
            }
            cacheOneIndex[model.MissionId.ToString()].Add(model);
        }
    

    }

}
